/*  
 *  Vunet.js JavaScript Library v1.2
 *  http://www.vunet.us/lib/vunet/api.html or see HOWTO section below
 *  (c) 2009 Vadym Ustymenko
 *  Vunet.js is freely distributable under the terms of an MIT-style license.
 */
var vunet = {
	Version : 1.3,
	Browser : {
		isIE: !!(window.attachEvent && !window.opera),
		isIE6: !!(window.attachEvent && !window.opera && !window.XMLHttpRequest),
		isOpera: !!window.opera,
		isSafari: navigator.userAgent.toLowerCase().indexOf('safari') > -1,
		isGecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
		isDOM: !!document.getElementById	
	},
	/*
    * CROSS-BROWSER XML HTTP REQUEST: 
    * howto: new vunet.AJAX.Loader('GET','index.html?id=1',true,handleResponse);
    * response: function handleResponse(){alert(this.req.responseText);}
    * Parameters:
    *     method: POST or GET
    *     url: local URL
    *     asynch: true or false
    *     respHandle: function name to handle response
    *     5th element: parameters for POST method
    * 	  6th element: error function handler (optional)
    */
    AJAX : {
    	READY_STATE_UNINITIALIZED : 0,
    	READY_STATE_LOADING : 1,
    	READY_STATE_LOADED : 2,
    	READY_STATE_INTERACTIVE : 3,
    	READY_STATE_COMPLETE : 4,   	
    	Loader : function(method,url,asynch,respHandle,params,onerror){
		    this.method =     method;
		    this.url =        url;
		    this.asynch =     asynch; 
		    this.respHandle = respHandle;
		    this.params =     params; 
		    this.onerror =    (onerror) ? onerror : this.defaultError;
		    this.req =        null;
		    this.loadXMLDoc(method,url,asynch,params);
	    }
    },
	loadScript: function(src) {
    	if(vunet.Browser.isIE){//IE crash fix
    		document.write('<script type="text/javascript" src="'+src+'"><\/script>');
    	}else{
	    	try{
				var script = document.createElement("script");
				script.src = src;
				script.type = "text/javascript";
				script.language = "JavaScript";
				//script.defer = true;
				var heads = document.getElementsByTagName("head");
				heads[0].appendChild(script);
			}catch(e){//inserting via DOM fails in Safari 2.0
				document.write('<script type="text/javascript" src="'+src+'"><\/script>');
			}
    	}
  	},
    $ : function(id){
    	return document.getElementById(id);
    },
	getHTML : function(tagName, id){
		if(id != null){
			var obj = this.$(id);
			if(obj) return obj;
		}
		var obj = document.createElement(tagName);
		if(id != null) obj.id = id;
		return obj;
	},
	removeHTML : function(id){
		var obj = this.$(id);
		if(obj) try{ obj.parentNode.removeChild(obj); }catch(e){}
	},
	getURLParameter : function(paramName, urlStr){
		paramName = paramName.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
		var regexS = "[\\?&]"+paramName+"=([^&#]*)";
		var regex = new RegExp(regexS);
		var myURL = (urlStr) ? urlStr : window.location.href;
		var results = regex.exec(myURL);
		if(results == null) return "";
			else return results[1];
	},
	util : {
		getQueryString : function(frm){
		    var str = "";
		    var elsLen = frm.elements.length;
		    for(var i=0; i<elsLen; i++){
		        var el = frm.elements[i];
				var and = (i != elsLen - 1) ? "&" : "";
				if(el.type == "checkbox" || el.type == "radio"){
					if(el.checked == true) str += el.name+"="+encodeURIComponent(el.value)+and;
				}else{
					str += el.name+"="+encodeURIComponent(el.value)+and;
				}
		    }
		  	return str;
		},
		getPageDims : function(){
			if (typeof window.innerWidth != 'undefined'){
		      	return [window.innerWidth, window.innerHeight];
			}else if (typeof document.documentElement != 'undefined' && 
					  typeof document.documentElement.clientWidth != 'undefined' && 
					  document.documentElement.clientWidth != 0){
					  //IE6 in standards compliant mode (with valid doctype)
				return [document.documentElement.clientWidth, document.documentElement.clientHeight];
			}else{
		       	return [document.getElementsByTagName('body')[0].clientWidth, 
		       			document.getElementsByTagName('body')[0].clientHeight];
			}
		},
		posLeft : function(){
	    	return typeof window.pageXOffset != 'undefined' ?  window.pageXOffset : document.documentElement
			         && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : 
			         document.body.scrollLeft ? document.body.scrollLeft : 0;
	    },
	    posTop : function(){
	    	return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement
			         && document.documentElement.scrollTop ? document.documentElement.scrollTop : 
			         document.body.scrollTop ? document.body.scrollTop : 0;
		},
		posRight : function(){ return vunet.util.posLeft() + vunet.util.getPageDims()[0]; },
		posBottom : function(){ this.util.posTop() + vunet.util.getPageDims()[1]; },
		findPosition : function(obj){
			var curLeft = curTop = 0;
			if(obj.offsetParent){
				curLeft = obj.offsetLeft;
				curTop = obj.offsetTop;
				while(obj = obj.offsetParent){
					curLeft += obj.offsetLeft;
					curTop += obj.offsetTop;
				}
			}
			return [curLeft,curTop]; 
		},
		getIframePad : function(topObj){/*IE6 select overlap fix*/
			var iframe = vunet.getHTML("IFRAME");		
	      	iframe.src = "#";
			iframe.frameborder = "0";
	      	iframe.style.position = "absolute";
			iframe.style.zIndex = (topObj.style.zIndex) ? parseInt(topObj.style.zIndex) - 1 : 0;
			iframe.style.filter = "alpha(opacity=0)";
			return iframe;
		},
		getCloseLink : function(){
			var span = vunet.getHTML("span");
			span = vunet.util.applyCSS(span,vunet.CSS.CLOSE);
			span.innerHTML = "X";
			return span;
		},	
		emptyNode : function(node){
			while(node.firstChild){
				node.removeChild(node.firstChild);
			}
		},
		clone : function(obj){
			if(typeof(obj) != "object" || obj==null) return obj;
		    var newObj = new Object();
			for(var i in obj){
				newObj[i] = obj[i];
			}
			return newObj;
		},
		applyCSS : function(obj,styleObj){
			for (var prop in styleObj){
				if(typeof obj.style[prop] != "undefined") obj.style[prop] = styleObj[prop];				
			}
			return obj;
		},
		sleep : function(ms){
			var dt = new Date();
			var dtNow = null;
			do { dtNow = new Date(); }
			while(dtNow - dt < ms);
		},
		stringToJSON : function(str){
				return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(str.replace(/"(\\.|[^"\\])*"/g, ''))) && eval('(' + str + ')');
		}
	},		
	addEvent : function(obj, type, fn) {
        if (obj.addEventListener){
        	obj.addEventListener(type, fn, false);
        }else if(obj.attachEvent){
        	obj.attachEvent('on' + type, function() { return fn.apply(obj, new Array(window.event));});
	  }
	},
	eventPool : null,
	addEvent : function(obj, type, fn) {
		if(this.eventPool == null){
			 this.eventPool = [];
			 vunet.addEvent(window, "unload", this.clearEvents);
		}
		if (typeof obj == "string") obj = this.$(obj);		
		if (obj.addEventListener){
			obj.addEventListener(type, fn, false);
			this.eventPool.push({obj: obj, type: type, fn: fn});
		}else if(obj.attachEvent){
			obj.attachEvent('on' + type, function() { return fn.apply(obj, new Array(window.event));});
			this.eventPool.push({obj: obj, type: type, fn: fn});
		}
	},
	clearEvents : function(){
		if(vunet.eventPool != null && vunet.eventPool.length>0){
			for (var i = 0; i < vunet.eventPool.length; i++) {			
				var el = vunet.eventPool[i];
				if (el.obj.removeEventListener) el.obj.removeEventListener(el.type, el.fn, false);
	            else if (el.obj.detachEvent) el.obj.detachEvent("on" + el.type, el.fn);
			}
		}
		vunet.eventPool = null;
	},
	Cookie : {
		name : "",
		value : "",
		domain : "",
		path : "",
		days : "",
		exp : ""
	},	
	setCookie : function(name,val,days,domain,path){
		this.Cookie.name 	= name;
		this.Cookie.value 	= val;
		this.Cookie.days 	= days;
		this.Cookie.domain 	= (domain) ? domain : "";
		this.Cookie.path	= (path) ? path : "/";
		var cookedDate = new Date();
		cookedDate.setTime(cookedDate.getTime()+(days*24*60*60*1000));
		this.Cookie.exp = cookedDate.toGMTString();
		this.saveCookie();	
	},
	saveCookie : function(){
		document.cookie = this.Cookie.name+"="+this.Cookie.value+
						"; expires="+this.Cookie.exp+
						"; path="+this.Cookie.path+""+
						((this.Cookie.domain!="")?"; domain="+this.Cookie.domain:"");
	},
	getCookie : function(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	},
	see: function(val) {
		var box = this.$("VunetDebugger");
		if(!box){
			box = this.getHTML("div");
			box.id = "VunetDebugger";
			var that = this;
			box.ondblclick = function(){ that.removeHTML("VunetDebugger"); };
			box = this.util.applyCSS(box,this.CSS.DEBUGGER);		
			var closeLink = this.util.getCloseLink();
			closeLink.onclick = function(){ that.removeHTML("VunetDebugger"); };
			box.appendChild(closeLink);
			var header = this.getHTML("div");
			header = this.util.applyCSS(header,this.CSS.DEBUGGER_HEADER);
			header.innerHTML = "LOG";
			box.appendChild(header);		
			document.body.appendChild(box);
		}
		try{
			val = val.replace(/<br>/g,"\n");
			val = val.replace(/</g,"&lt;");
			val = val.replace(/>/g,"&gt;");
			val = val.replace(/\n/g,"<br>");
		}catch(err){alert(err)/*bad type*/}
		box.innerHTML += "<hr style='border:1px dashed white'>" + val;
	},
	seeObject : function(obj){
		var resp = "Object: \n";
		for(var i in obj){
			resp+=" "+i+"="+obj[i]+"\n";
		} 
		return resp;
	},
	fadePage : function(w,h,content){
		var div = this.getHTML("div","fadedBackground");	
		div = this.util.applyCSS(div,this.CSS.FADER);
		div.innerHTML = "&nbsp;";//filler fix
		var that = this;
		div.onclick = function(){that.unfadePage();}
		this.fader = div;
		document.body.style.height = "100%";//keep full height
		document.body.firstChild.parentNode.insertBefore(this.fader, document.body.firstChild);
		if(this.Browser.isIE){  
			this.fader.style.position = "absolute";
			this.fader.style.setExpression("top","document.all['fadedBackground'].offsetParent.scrollTop");
			if(this.Browser.isIE6){
				var faderPad = this.util.getIframePad(this.fader);
				faderPad.id = "fadedPad";
	        	faderPad.style.left = this.fader.style.left;
	        	faderPad.style.top = this.fader.style.top;
	        	faderPad.style.width = this.fader.style.width;
	        	faderPad.style.height = this.fader.style.height;
				this.faderPad = faderPad;
	            document.body.firstChild.parentNode.insertBefore(this.faderPad, document.body.firstChild.nextSibling);
	            //this.faderPad.style.setExpression("top","document.all['fadedPad'].offsetParent.scrollTop");
			}
		}else{
			this.fader.style.position = "fixed";
		}
		if(arguments.length>0){
			var dims = this.util.getPageDims();
			var height = parseInt(dims[1]*0.8);
			var width = parseInt(dims[0]*0.8);
			var top = (dims[1] - height)/2;
			var left = (dims[0] - width)/2;
			if(w){ width = w;  left = parseInt((dims[0] - w)/2); }
			if(h){ height = h; top = parseInt((dims[1] - h)/2); }
			left = (left<10)?10:left;
			top = (top<10)?10:top;
			var container = this.getHTML("div","fadedContainer");
			container = this.util.applyCSS(container,this.CSS.FADER_CONTAINER);
			container.style.top = (this.util.posTop()+top)+"px";
			container.style.left = left+"px";
			container.style.width = width+"px";
			container.style.height = height+"px";
			if(typeof content == "string"){container.innerHTML = content;
			}else if(typeof content == "object"){container.appendChild(content);}
			this.faderContent = container;
			document.body.firstChild.parentNode.insertBefore(this.faderContent, document.body.firstChild);
		}
	},
    unfadePage : function(){
		if(this.fader){document.body.removeChild(this.fader);this.fader=null;}
		if(this.faderPad){document.body.removeChild(this.faderPad);this.faderPad=null;}
		if(this.faderContent){document.body.removeChild(this.faderContent);this.faderContent=null;}
	},
    tooltip : false,
    tooltipShadow : false,
    tooltipPad : false,
    showTooltip : function(e,ttTxt){
		var shadowSize = 4;
		var tooltipMaxWidth = 200;
		var tooltipMinWidth = 100;
        var bodyWidth = Math.max(document.body.clientWidth,document.documentElement.clientWidth) - 20;
        if(!this.tooltip){
            var div = vunet.getHTML("div");
            div.id = "tooltip";
            div = this.util.applyCSS(div,this.CSS.TOOL_TIP);
			this.tooltip = div;
			var shadow = vunet.getHTML("div");
			shadow.id = "tooltipShadow";
			shadow = this.util.applyCSS(shadow,this.CSS.TOOL_TIP_SHADOW); 
			shadow.style.zIndex = parseInt(div.style.zIndex) - 1;
			this.tooltipShadow = shadow;
            document.body.appendChild(this.tooltip);
            document.body.appendChild(this.tooltipShadow);   
           	if(this.Browser.isIE6){
				this.tooltipPad = this.util.getIframePad(this.tooltipShadow);
                document.body.appendChild(this.tooltipPad);
            }
        }  
        this.tooltip.style.display = "block";
        this.tooltipShadow.style.display = "block";
        if(this.Browser.isIE6)this.tooltipPad.style.display = "block";      
        var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
        if(this.Browser.isSafari) st = 0;
        var leftPos = e.clientX + 10;     
        this.tooltip.style.width = null;//reset
        this.tooltip.innerHTML = ttTxt;
        this.tooltip.style.left = leftPos + "px";
        this.tooltip.style.top = e.clientY + 10 + st + "px";      
        this.tooltipShadow.style.left =  leftPos + shadowSize + "px";
        this.tooltipShadow.style.top = e.clientY + 10 + st + shadowSize + "px";      
        if(this.tooltip.offsetWidth > tooltipMaxWidth){/* Exceeding max width? */
        	this.tooltip.style.width = tooltipMaxWidth + 'px';
        }    
        var tooltipWidth = this.tooltip.offsetWidth;       
        if(tooltipWidth < tooltipMinWidth) tooltipWidth = tooltipMinWidth;     
        this.tooltip.style.width = tooltipWidth + "px";
        this.tooltipShadow.style.width = this.tooltip.offsetWidth + "px";
        this.tooltipShadow.style.height = this.tooltip.offsetHeight + "px";           
        if((leftPos + tooltipWidth) > bodyWidth){
        	this.tooltip.style.left = (this.tooltipShadow.style.left.replace("px","") - ((leftPos + tooltipWidth)-bodyWidth)) + "px";
        	this.tooltipShadow.style.left = (this.tooltipShadow.style.left.replace("px","") - ((leftPos + tooltipWidth)-bodyWidth) + shadowSize) + "px";
        }  
        if(this.Browser.isIE6){
        	this.tooltipPad.style.left = this.tooltip.style.left;
        	this.tooltipPad.style.top = this.tooltip.style.top;
        	this.tooltipPad.style.width = this.tooltip.offsetWidth + "px";
        	this.tooltipPad.style.height = this.tooltip.offsetHeight + "px";
        }        
    },
    hideTooltip : function (){
        this.tooltip.style.display="none";
        this.tooltipShadow.style.display="none";       
        if(this.Browser.isIE6)this.tooltipPad.style.display="none";       
    },
	fx : {
		s : 33,
		fadeOut : function(el,obj){
			var s = (typeof obj == "object" && typeof obj.speed != "undefined" && isNaN(obj.speed) == false) ? obj.speed*100 : vunet.fx.s;
			if(typeof el == 'string') el = vunet.$(el);
			vunet.fx.setOp(el,1);
			setTimeout("vunet.fx.anim('" + el.id + "',false,"+s+")", s);
		},
		fadeIn : function(el,obj){
			var s = (typeof obj == "object" && typeof obj.speed != "undefined" && isNaN(obj.speed) == false) ? obj.speed*100 : vunet.fx.s;
			if(typeof el == 'string') el = vunet.$(el);
			vunet.fx.setOp(el,0);
			setTimeout("vunet.fx.anim('" + el.id + "',true,"+s+")", s);
		},
		anim : function(el,grow,s){
			if(typeof el == 'string') el = vunet.$(el);
			var op = parseFloat(el.style.opacity);
			if(grow==true){
				op += 0.1;
				if(op>1)return;
			}else{
				op -= 0.1;
				if(op<0)return;
			}
			vunet.fx.setOp(el,op);
			setTimeout("vunet.fx.anim('" + el.id + "'," + grow + ","+s+")", s);
		},
		setOp : function(el,n){
			el.style.opacity = n;
    		el.style.filter = 'alpha(opacity = ' + (n*100) + ')';
		}
	},
	CSS : {
		DEBUGGER : {
			position : "absolute",
			top : "50px",
			right : "5px",
			width : "40%",
			zIndex : "10001",//more than fader
			border : "1px solid red",
			backgroundColor : "black",
			overflow : "auto",
			color : "white",
			filter : "alpha(opacity=85)",
			opacity : ".85",
			MozOpacity : ".85"
		},
		DEBUGGER_HEADER : {
			textAlign : "center",
			color : "red",
			fontWeight : "bolder"
		},
		CLOSE : {
			position : "absolute",
			width : "18px",
			height : "18px",
			font : "bold 16px verdana",
			color : "red",
			top : "0px",
			right : "0px",
			cursor : "pointer"
		},
		FADER : {
			height : "100%",
			width : "100%",
			top : "0px",
			left : "0px",
			backgroundColor : "#000",
			zIndex : "10000",//check with debugger
			filter : "alpha(opacity=50)",
			opacity : ".50",
			MozOpacity : ".50"
		},
		FADER_CONTAINER : {
			position : "absolute",
			backgroundColor : "#fff",
			border : "5px solid #666",
			padding : "5px",
			zIndex : "10001",
			height : "auto"//fix height
		},
		TOOL_TIP : {
			backgroundColor : "lightyellow",
            border : "1px solid #000",
            position : "absolute",
            display : "none",
            zIndex : "10002",
            fontSize : "0.9em",
            fontFamily : "arial",
            padding : "2px",
            mozBorderRadius : "6px",
            padding : "2px"
		},
		TOOL_TIP_SHADOW : {
			position : "absolute",
            backgroundColor : "#555",
            display : "none",
            filter : "alpha(opacity=65)",
            opacity : ".65",
            MozOpacity : ".65",
            mozBorderRadius : "6px"
		}		
	}
};

vunet.AJAX.Loader.prototype = {
	  loadXMLDoc:function(method,url,asynch,params){       	      
	      if(window.XMLHttpRequest){//Mozilla-based browsers
	          this.req = new XMLHttpRequest();      
	      }else if(window.ActiveXObject){//Internet Explorer
	          this.req = new ActiveXObject("Msxml2.XMLHTTP");
	          if(!this.req){
	              this.req = new ActiveXObject("Microsoft.XMLHTTP");
	          }
	      }	      
	      if(this.req){//test for null request
	          if(method.toLowerCase() != "post"){
	              this.initReq(method,url,asynch);
	          }else{//POSTed data
	              var args = arguments[3];
	              if(args != null && args.length > 0){
	                  this.initReq(method,url,asynch,args);
	              }
	          }
	      }else{
	          alert("Your browser does not permit the use of all "+
	                "of this application's features!");
	      }   
	    },
	    initReq:function(method,url,asynch,args){       
	      try{
	          //Specify the function which will handle HTTP response
	          var loader = this;
	          this.req.onreadystatechange = function(){                               
	              loader.onReadyState.call(loader);
	          }
	          this.req.open(method,url,asynch);
	          //POSTed data
	          if(method.toLowerCase() == "post"){
	              this.req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
	              this.req.send(arguments[3]);   
	          }else{
	              this.req.send(null);
	          }
	      }catch (errv){
	          alert("The application cannot contact the server at the moment. Error details: "+errv.message);
	      }       
	    },
	    onReadyState:function(){
	      var req = this.req;
	      var ready = req.readyState;
	      if(ready == vunet.AJAX.READY_STATE_COMPLETE){       
	           var httpStatus = req.status;
	           if(httpStatus == 200 || httpStatus == 0){
	               this.respHandle.call(this);              
	           }else{
	               this.onerror.call(this);
	           }
	      }
	  },
	  defaultError:function(){
	      alert("error fetching data!"
	      +"\n\nreadyState:"+this.req.readyState
	      +"\nstatus: "+this.req.status
	      +"\nheaders: "+this.req.getAllResponseHeaders());
	  }
}
Number.prototype.toDecimals = function(n){
    n = (isNaN(n))? 2 : n;
    var nT = Math.pow(10,n);
    function pad(s){
        s = s||'.';
        return (s.length>n)? s : pad(s+'0');
    }
    return (isNaN(this)) ? this : (new String(Math.round(this*nT)/nT)).replace(/(\.\d*)?$/,pad);
}
String.prototype.trim = function(){
	return (this.replace(/^\s+/,'').replace(/\s+$/,''));
}
String.prototype.endsWith = function(str){
	return (this.length - str.length) == this.lastIndexOf(str);
}
Array.prototype.removeArrayItems = function(itemsToRemove){alert("test")
	var j;
	for(var i=0; i<itemsToRemove.length; i++){
		j=0;
		while(j<this.length){
			if(this[j]==itemsToRemove[i]){
				this.splice(j,1);
			}else{
				j++;
			}
		}
	}
}


/* HOWTO
 * Detect browser: 	vunet.Browser.isIE
 * 				   	vunet.Browser.isIE6
 * 					vunet.Browser.isOpera 
 * 					vunet.Browser.isSafari
 * 					vunet.Browser.isGecko
 * 					vunet.Browser.isDOM
 * Format querystring with all form elements:
 * 					vunet.getQueryString(document.MY_FORM_NAME)
 * Make AJAX calls:
 * 					new vunet.AJAX.Loader('GET','index.html?id=1',true,handleResponse);
 * 					new vunet.AJAX.Loader('POST','index.html',true,handleResponse,"id=1");
 * 			Handler function example: 
 * 					function handleResponse(){alert(this.req.responseText);}
 * Debug with Logger, alerts & appends multiple messages to one floated box: 
 * 					vunet.see("Some message")
 * 			(on double click closes box)
 * Tooltip to display hidden text: 
 * 					vunet.showTooltip(event,'add text here')
 * 			can be added to onMouseOver or onClick events in HTML
 * 			hide tooltip with onMouseOut: 
 * 					vunet.hideTooltip()
 * Fade full page & show box with content:
 * 					vunet.fadePage(WIDTH,HEIGHT,HTML_STRING_OR_DOM_OBJECT_CONTENT)
 * Create cookies:
 * 					vunet.setCookie(COOKIE_NAME,VALUE,FOR_HOW_MANY_DAYS,DOMAIN*,PATH*)
 * 			* = optional, ex.: vunet.setCookie("MyCookie","I store this cookie for a week",7);
 * 					vunet.getCookie("MyCookie")
 * Empty DOM object:
 * 					vunet.util.emptyNode(document.getElementById("myTableWithRows"))	
 * Add multiple events (cross browser):
 * 					vunet.addEvent(window, "load", function_name_to_run)
 * Get HTML object by id or create new one:
 * 					var myDiv = vunet.getHTML("div", "someIdString") //2nd parameter searches 
 * 																	//element by ID first and returns if found 																  
 * 					var myLink = vunet.getHTML("a") //new element created
 * Clone object:
 * 					var myClone = vunet.util.clone(document.getElementById("myHtmlObject"));
 * Find any object position:
 * 					var position = vunet.util.findPosition(document.getElementById("myHtmlObject"));
 * 					alert("Position left = "+position[0]+", right = "+position[1]+"");
 * Load JavaScript file dynamically (on demand):
 * 					vunet.loadScript("http://wwww.vunet.us/lib/vunet/vunet.js");
 * Fade In/Out Effects:
 * 					vunet.fx.fadeIn("elementID",{"speed":0.5}); vunet.fx.fadeIn(objectID);
 * 					vunet.fx.fadeOut("elementID,{"speed":0.7}); vunet.fx.fadeOut(objectID);
 * ===================================Prototype add-ons ===================================
 * Convert number to decimals:
 * 					var number = 1.123456789; number.toDecimals(2); //result = 1.12
 * Check if string ends with substring (like Java method endsWidth()):
 * 					if("vunet".endsWith("net")){ alert("Yes, vunet ends with net"); }
 */


//Version History Log 
//v 1.0 - inital release
//v 1.1 - clone function modified
//v 1.2 - added checkbox and radio support to getQueryString function; 
//			added getURLParameter function
//			added stringToJSON utility method for secure string response validation and conversion to JSON object
//			added loadScript function
//v 1.3 - added fade-in, fade-out effect functions, fixed loading script in IE, added memory clean-up methods